Skip to content

docs(spec): front-door and branded-types examples compile against the real exports map (+os:check markers) - #11531

Merged
os-steve merged 1 commit into
mainfrom
claude/issue-11436-front-door-examples
Aug 24, 2026
Merged

os-steve merged 1 commit into
mainfrom
claude/issue-11436-front-door-examples

Conversation

@os-steve

Copy link
Copy Markdown
Collaborator

Fixes #11436

Status: DRAFT — clause-② path limb (diff lives under packages/spec/src/**,
substantively no accept/reject or export-surface change). needs:contract-review
is on the card; this PR stays draft for the PM's review, per the dispatch
contract.

Two defect classes

  1. packages/spec/src/index.ts — the front door's three import-style
    blocks.
    Style 1 taught a root namespace-import style
    (import { Data, UI, System, Auth, AI, API } from '@objectstack/spec') the
    root has never exported — the file's own preamble already conceded as much.
    Styles 2–3 both named @objectstack/spec/auth, a subpath the exports map
    has never declared (the real one is @objectstack/spec/identity).
  2. packages/spec/src/shared/branded-types.zod.ts:14 — named
    ObjectNameSchema / FieldNameSchema from the package root. Both symbols
    exist, but resolve from @objectstack/spec/shared, never the root.

What each block teaches now

Measured against the package's real exports map (packages/spec/package.json)
and its built declarations — no new export, no widened surface, docblocks only:

  • Style 1 — Root-Level Factory Imports (reframed, not dropped). The root
    genuinely does export a curated set of authoring defineX factories
    (defineStack, defineView, defineApp, defineFlow, defineAgent,
    defineTool, defineSkill, …) for direct top-level use, even though it
    exports no type namespaces. The block now imports defineSkill from the
    root and calls it with a real, compiling config — teaching the true
    root-level surface instead of a fabricated one.
  • Style 2 — Namespace Imports via Subpath: import * as Identity from '@objectstack/spec/identity' replaces the /auth import; Auth.User →
    Identity.User.
  • Style 3 — Direct Subpath Imports: import { User } from '@objectstack/spec/identity' replaces import { User, Session } from '@objectstack/spec/auth'. Session is dropped rather than mis-sourced —
    the bare Session type is deliberately not declared in identity (see the
    comment at identity.zod.ts:164); the wire shape lives in
    @objectstack/spec/api and pulling in a third subpath for one name did not
    earn its place in an already-two-subpath example.
  • Both User literals gained the schema's two required timestamp fields
    (createdAt, updatedAt) — present in the type, silently never checked
    before because the broken import made every downstream usage unreachable to
    tsc.
  • branded-types.zod.ts: @objectstack/spec → @objectstack/spec/shared.
    No other change.

Front-door docs-shape decision

The card flagged this as worth deciding rather than guessing: whether
index.ts's header should keep documenting a namespace-import style at all.
Went with the measurement-driven default stated in the dispatch — but chose
"truthfully reframe" over "drop" for Style 1, because the root really does
export something meaningful at that path (the defineX factories), and
dropping it down to two styles would have made the header thinner without
making it more honest. The header's opening prose was rewritten to state
plainly what the root does and does not export, rather than leaving the old
"this package does NOT export types at the root level" sentence to silently
disagree with a fixed Style 1 block the way it disagreed with the broken one.

Verified at 41ea937bc7 (this PR's head commit).

Gate count

pnpm --filter @objectstack/spec check:skill-examples — spec-source surface
6 → 10 marked blocks (4 new: 3 in index.ts, 1 in branded-types.zod.ts),
matching the card's acceptance count exactly (the reframed Style 1 counts as
the 4th new block, same as a literal one-for-one repair would have).

Verification

  • pnpm --filter @objectstack/spec build
  • pnpm --filter @objectstack/spec check:skill-examples — green, 10 marked
    spec-source block(s) (was 6), 257 prose examples type-check across 3 surface(s) overall.
  • Reverse verification: added the os:check marker to all four blocks
    against the OLD (broken) text first. Gate went red with exactly the card's
    diagnostics — TS2305 on Data/UI/System/Auth/AI/API, TS2307 on
    @objectstack/spec/auth (×2), TS2305 on ObjectNameSchema/FieldNameSchema.
    Rewrote to the real exports/declarations in place (still committed as the
    repair, no separate revert needed since the final state is the marked+fixed
    text) — gate went green.
  • pnpm --filter @objectstack/spec typecheck — green (tsc --noEmit +
    check:scripts-typecheck + check:test-typecheck, test-layer debt ledger
    unchanged).
  • pnpm --filter @objectstack/spec test — green: Test Files 420 passed (420), Tests 11204 passed (11204).
  • pnpm --filter @objectstack/spec check:generated — 1 artifact proved stale
    (check:docs, because the fixed @example in branded-types.zod.ts feeds
    the generated reference page) → pnpm --filter @objectstack/spec gen:docs,
    re-ran clean (14/14). Regen diff audited: exactly the one-line specifier fix
    propagated into content/docs/references/shared/branded-types.mdx, nothing
    else moved.
  • Targeted ESLint (index.ts, branded-types.zod.ts) — clean.
  • node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack derived
    27 matched local gate families (+5 changeset-triggered once the changeset was
    added) for this diff; all ran green except node scripts/check-dev-prereqs.mjs,
    which failed on unrelated packages' missing dist/ (this worktree never ran a
    full pnpm build) — an environment precondition, not a regression from this
    diff (spec's own dist is fresh and green everywhere else).
  • Changeset added: .changeset/front-door-examples-compile.md (patch,
    @objectstack/spec).

Generated by Claude Code

… real exports map (+os:check markers)

Fixes #11436

Four self-contained TSDoc @example blocks in packages/spec/src did not
compile against the package's own built declarations. index.ts's front-door
header taught a root namespace-import style the root has never exported, and
two subpath-import styles named the nonexistent `@objectstack/spec/auth`
(the real subpath is `@objectstack/spec/identity`). branded-types.zod.ts
named ObjectNameSchema/FieldNameSchema from the root; both resolve only from
`@objectstack/spec/shared`.

Rewrote all four against the current exports map and built declarations,
reframing (not dropping) the front door's Style 1 around the defineX
factory imports the root genuinely does export, and added the os:check
marker to all four so check:skill-examples keeps them honest. Spec-source
surface: 6 -> 10 marked blocks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T9cDbY2NBiVJWYx3BpWfH2
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ✅

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/src/shared/branded-types.zod.ts) — pages documenting those are invisible to this run

Coarse fallback — 126 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d10e2146263913d0f81b36607b41d21926249837 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 78886d7a65e91b5ad25e38e700427ae3da793a62 — the merge of head 41ea937bc7a1ac1d909ba503c47caf9f5cec5be4 into base d10e2146263913d0f81b36607b41d21926249837, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 78886d7a65e91b5ad25e38e700427ae3da793a62 && git checkout 78886d7a65e91b5ad25e38e700427ae3da793a62
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d10e2146263913d0f81b36607b41d21926249837 41ea937bc7a1ac1d909ba503c47caf9f5cec5be4 && git checkout -B drift-repro d10e2146263913d0f81b36607b41d21926249837 && git merge --no-ff 41ea937bc7a1ac1d909ba503c47caf9f5cec5be4

node scripts/docs-audit/affected-docs.mjs --json d10e2146263913d0f81b36607b41d21926249837

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Aug 24, 2026
@os-steve
os-steve marked this pull request as ready for review August 24, 2026 02:33
@os-steve
os-steve added this pull request to the merge queue Aug 24, 2026
Merged via the queue into main with commit 3bfa1e6 Aug 24, 2026
32 checks passed
@os-steve
os-steve deleted the claude/issue-11436-front-door-examples branch August 24, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants